<?php
// Copyright 2019 Hackware SpA <human@hackware.cl>
// This file is part of "Hackware Web Services Wallet" and licensed under
// the terms of the GNU Affero General Public License version 3, or (at your
// option) a later version. You should have received a copy of this license
// along with the software. If not, see <https://www.gnu.org/licenses/>.

namespace Hawese\Wallet;

use Hawese\Core\TableModel as BaseTableModel;

/**
 * This class contains a helper for serialization of string decimal values.
 * @deprecated Next release will use MoneyPHP.
 */
class TableModel extends BaseTableModel
{
    public function jsonSerialize()
    {
        $attributes = parent::jsonSerialize();
        array_walk($attributes, function (&$field) {
            if (is_numeric($field)) {
                $field = $field + 0;
            }
        });
        return $attributes;
    }
}
